home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Puzzle / MasterMind.swf / scripts / DefineButton2_45 / BUTTONCONDACTION on(press).as
Encoding:
Text File  |  2005-08-05  |  2.7 KB  |  120 lines

  1. on(press){
  2.    toate = true;
  3.    i = 1;
  4.    while(4 >= i)
  5.    {
  6.       if(places[i] == 0)
  7.       {
  8.          toate = false;
  9.       }
  10.       i++;
  11.    }
  12.    if(toate == true and maxlevel >= nivel)
  13.    {
  14.       if(nivel != maxlevel + 1)
  15.       {
  16.          i = 1;
  17.          while(4 >= i)
  18.          {
  19.             duplicateMovieClip(_root[places[i]],"nuconteaza" + nivel + i,16384 + kkk++);
  20.             _root["nuconteaza" + nivel + i].gotoAndStop(2);
  21.             i++;
  22.          }
  23.          i = 1;
  24.          while(8 >= i)
  25.          {
  26.             _root[i]._y = _root["locbulin" + i]._y;
  27.             _root[i]._x = _root["locbulin" + i]._x;
  28.             pieceplaces[i] = i;
  29.             i++;
  30.          }
  31.          i = 1;
  32.          while(4 >= i)
  33.          {
  34.             duplicateMovieClip(_root["albaneagra" + i],"nuconteazaan" + nivel + i,16384 + kkk++);
  35.             if(nivel != maxlevel)
  36.             {
  37.                _root["albaneagra" + i]._y -= 20;
  38.             }
  39.             if(nivel != maxlevel)
  40.             {
  41.                _root["albaneagra" + i].gotoAndStop(1);
  42.             }
  43.             i++;
  44.          }
  45.          k = 1;
  46.          i = 1;
  47.          while(4 >= i)
  48.          {
  49.             if(generatele[i] == places[i])
  50.             {
  51.                this["nuconteazaan" + nivel + k].gotoAndStop(2);
  52.                k++;
  53.             }
  54.             i++;
  55.          }
  56.          kk = k;
  57.          i = 1;
  58.          while(4 >= i)
  59.          {
  60.             j = 1;
  61.             while(4 >= j)
  62.             {
  63.                if(i != j and generatele[i] == places[j])
  64.                {
  65.                   this["nuconteazaan" + nivel + kk].gotoAndStop(3);
  66.                   kk++;
  67.                }
  68.                j++;
  69.             }
  70.             i++;
  71.          }
  72.          if(k == 5)
  73.          {
  74.             i = 1;
  75.             while(8 >= i)
  76.             {
  77.                _root[i].gotoAndStop(2);
  78.                i++;
  79.             }
  80.             showwin("win");
  81.          }
  82.          else
  83.          {
  84.             i = 1;
  85.             while(4 >= i)
  86.             {
  87.                if(nivel != maxlevel)
  88.                {
  89.                   _root["bulin" + i]._y -= 20;
  90.                }
  91.                i++;
  92.             }
  93.             if(nivel != maxlevel)
  94.             {
  95.                nivel++;
  96.                curlevel = nivel;
  97.             }
  98.             else
  99.             {
  100.                i = 1;
  101.                while(8 >= i)
  102.                {
  103.                   _root[i].gotoAndStop(2);
  104.                   i++;
  105.                }
  106.                showwin("lose");
  107.             }
  108.          }
  109.          i = 1;
  110.          while(4 >= i)
  111.          {
  112.             places[i] = 0;
  113.             i++;
  114.          }
  115.       }
  116.       trace(generatele);
  117.       trace(places);
  118.    }
  119. }
  120.